/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.ac.iie.di.wx.server.utils;

import java.text.ParseException;

/**
 *
 * @author Administrator
 */
public class TimeStampUtil {

    public static void main(String[] args) throws ParseException, Exception {
//        Starter.init();
//        TimeStampUtil stampUtil = new TimeStampUtil();
//        for (int i = 0; i < 10; i++) {
//            System.out.println(stampUtil.nextId());
//        }
        long a = System.currentTimeMillis()/1000;
        System.out.println(a);
//        RedisAtomicLong atomicLong=new 
    }
    private static long INFOID_FLAG = 1490000000000L;
    protected static int SERVER_ID = 1;

    public synchronized static long nextId() throws Exception {
        if (SERVER_ID <= 0) {
            throw new Exception("server id is error,please check config file!");
        }
        long infoid = System.currentTimeMillis();
//        System.out.println(infoid);
//        infoid = infoid | SERVER_ID;
        Thread.sleep(1);
        return infoid;
    }
}
